package com.huobi.han;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author by HLL.
 * @date:2017-11-15
 * @description:
 */
@Controller
public class IndexController {
    @Value("${userName1}")
    private String userName1;

    @Value("${bookTitle}")
    private String bookTitle;

    @RequestMapping(value="/index")
    public String index(ModelMap map) {
        // 加入一个属性，用来在模板中读取
        map.addAttribute("name", userName1);
        map.addAttribute("bookTitle", bookTitle);
        // return模板文件的名称，对应src/main/resources/templates/welcome.html
        return "index";
    }
}
